{% extends "base.html" %}

{% block content %}
<div class="container mt-4">
    <h2>Organization Dashboard</h2>
    
    <!-- Statistics Cards -->
    <div class="row mt-4">
        <div class="col-md-3">
            <div class="card">
                <div class="card-body">
                    <h5 class="card-title">Total Activities</h5>
                    <p class="card-text display-4">{{ stats.total_activities }}</p>
                </div>
            </div>
        </div>
        <div class="col-md-3">
            <div class="card">
                <div class="card-body">
                    <h5 class="card-title">Pending Activities</h5>
                    <p class="card-text display-4">{{ stats.pending_activities }}</p>
                </div>
            </div>
        </div>
        <div class="col-md-3">
            <div class="card">
                <div class="card-body">
                    <h5 class="card-title">Active Activities</h5>
                    <p class="card-text display-4">{{ stats.active_activities }}</p>
                </div>
            </div>
        </div>
        <div class="col-md-3">
            <div class="card">
                <div class="card-body">
                    <h5 class="card-title">Total Volunteers</h5>
                    <p class="card-text display-4">{{ stats.total_volunteers }}</p>
                </div>
            </div>
        </div>
    </div>

    <!-- Quick Actions -->
    <div class="row mt-4">
        <div class="col-12">
            <div class="card">
                <div class="card-body">
                    <h5 class="card-title">Quick Actions</h5>
                    <a href="{{ url_for('organization_new_activity') }}" class="btn btn-primary">Post New Activity</a>
                    <a href="{{ url_for('organization_activities') }}" class="btn btn-secondary">Manage Activities</a>
                    <a href="{{ url_for('organization_profile') }}" class="btn btn-info">Organization Profile</a>
                </div>
            </div>
        </div>
    </div>

    <!-- Recent Activities -->
    <div class="row mt-4">
        <div class="col-12">
            <div class="card">
                <div class="card-body">
                    <h5 class="card-title">Recent Activities</h5>
                    <div class="table-responsive">
                        <table class="table">
                            <thead>
                                <tr>
                                    <th>Activity Name</th>
                                    <th>Status</th>
                                    <th>Start Date</th>
                                    <th>Registrations</th>
                                    <th>Actions</th>
                                </tr>
                            </thead>
                            <tbody>
                                {% for activity in recent_activities %}
                                <tr>
                                    <td>{{ activity.title }}</td>
                                    <td>
                                        <span class="badge {% if activity.status == 'pending' %}bg-warning text-dark
                                              {% elif activity.status == 'approved' %}bg-success
                                              {% elif activity.status == 'rejected' %}bg-danger
                                              {% elif activity.status == 'completed' %}bg-info
                                              {% else %}bg-secondary{% endif %}">
                                            {% if activity.status == 'pending' %}Pending Review
                                            {% elif activity.status == 'approved' %}Approved
                                            {% elif activity.status == 'rejected' %}Rejected
                                            {% elif activity.status == 'completed' %}Completed
                                            {% else %}Unknown Status{% endif %}
                                        </span>
                                    </td>
                                    <td>{{ activity.start_date.strftime('%Y-%m-%d') }}</td>
                                    <td>{{ activity.current_participants }}/{{ activity.max_participants }}</td>
                                    <td>
                                        <a href="{{ url_for('activity_detail', activity_id=activity.id) }}" 
                                           class="btn btn-sm btn-info">View</a>
                                        <a href="{{ url_for('organization_edit_activity', activity_id=activity.id) }}" 
                                           class="btn btn-sm btn-primary">Edit</a>
                                    </td>
                                </tr>
                                {% endfor %}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 